#ifndef TCPSERVER_H
#define TCPSERVER_H
#include "header.h"
#include "acceptor.hpp"
#include "eventloop.hpp"
#include <functional>
namespace moqi
{

using TcpConnecitonCallback = std::function<void(TcpConnectionPtr)>;
class TcpServer
{
public:
    TcpServer(const unsigned int& port,const string & ip = "127.0.0.1");
    ~TcpServer();
    void start();
    void stop();
    void setAllConnectionCallback(TcpConnecitonCallback &&cb1,
                                  TcpConnecitonCallback &&cb2,
                                  TcpConnecitonCallback &&cb3
                                 )
    {
        _loop.setAllCallback(std::move(cb1), std::move(cb2), std::move(cb3));
    }

private:
    Acceptor _acceptor;
    EventLoop _loop;
    
};

}//end of namespace moqi
#endif //~TCPSERVER_H
